﻿@using System.Data
@using ZoomLa.Common
@using ZoomLa.Model
@using ZoomLa.BLL
@model ZoomLa.SQLDAL.SQL.PageSetting
@{
    Model.cols = 4;
}
@functions {
    //判断是否已选该试题
    public string GetCheck(string pid, string selids)
    {
        if (selids.Contains("," + pid + ","))
        {
            return "<input type='checkbox' name='idchk' checked='checked' value='" + pid + "'/>";
        }
        else {
            return "<input type='checkbox' name='idchk' value='" + pid + "'/>";
        }
    }
    //取类别
    public string GetClass(string classid)
    {
        int id = DataConverter.CLng(classid);
        B_Exam_Class bec = new B_Exam_Class();
        M_Exam_Class mec = bec.GetSelect(id);
        if (mec != null && mec.C_id > 0)
        {
            return mec.C_ClassName;
        }
        else
        {
            return "";
        }
    }
    //取题型
    public string GetType(string id)
    {
        return M_Exam_Sys_Questions.GetTypeStr(DataConverter.CLng(id));
    }
}
<div id="EGV">
    <table class="table table-striped table-bordered table-hover text-center">
        <tr>
            <td>选择</td>
            <td>ID</td>
            <td>试题标题</td>
            <td>科目</td>
            <td>题型</td>
        </tr>
        @foreach (DataRow dr in Model.dt.Rows)
        {
            <tr>
                <td class="td_s">@MvcHtmlString.Create(GetCheck(dr["p_id"].ToString(), ViewBag.selids))</td>
                <td>@dr["p_id"]</td>
                <td>@dr["p_title"]</td>
                <td>@GetClass(dr["p_Class"].ToString())</td>
                <td>@GetType(dr["p_Type"].ToString())</td>
            </tr>
        }
        @Html.Partial("_page", Model)
    </table>
</div>
